﻿@model Product
@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutStore.cshtml";
    <script src="~/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="~/Content/ckfinder/ckfinder.js" type="text/javascript" ></script>
    <script src="~/Content/ckeditor/ckeditor.js" type="text/javascript"></script>
  }
<h2>Product Management</h2>



@using (Html.BeginForm("Index", "Home", 
    FormMethod.Post, new {enctype="multipart/form-data" }))
{
    
<div id="tabs">
    <ul>
        <li><a href="#T1">Sửa và Cập Nhật</a></li>
        <li><a href="#T2">Danh Sách Sản Phẩm</a></li>
    </ul>
    <div id="T1">
      
    @Html.ValidationSummary()
    <table class="form-view">
        <tr>
            <th>Id</th>
            <td>@Html.TextBoxFor(m => m.Id)</td>
        </tr>
        <tr>
            <th>Name</th>
            <td>@Html.TextBoxFor(m => m.Name)</td>
        </tr>
        <tr>
            <th>Unit Price</th>
            <td>@Html.TextBoxFor(m => m.UnitPrice)</td>
        </tr>
        <tr>
            <th>Unit Description</th>
            <td>@Html.TextBoxFor(m => m.UnitDesc)</td>
        </tr>
        <tr>
            <th>Quantity</th>
            <td>@Html.TextBoxFor(m => m.Quantity)</td>
        </tr>
        <tr>
            <th>Discount</th>
            <td>@Html.TextBoxFor(m => m.Discount)</td>
        </tr>
        <tr>
            <th>Product Date</th>
            <td>@Html.TextBoxFor(m => m.ProductDate, new { @id = "datepicker" })</td>
            </tr>
        <tr>
             <th>  Format options:</th>
            <td>
                <select id="format">
                    <option value="mm/dd/yy">Default - mm/dd/yy</option>
                    <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
                    <option value="d M, y">Short - d M, y</option>
                    <option value="d MM, y">Medium - d MM, y</option>
                    <option value="DD, d MM, yy">Full - DD, d MM, yy</option>
                    <option value="&apos;day&apos; d &apos;of&apos; MM &apos;in the year&apos; yy">With text - 'day' d 'of' MM 'in the year' yy</option>
                </select>
            </td>
        </tr>
        <tr>
            <th>Product Image</th>
            <td>
               @Html.TextBoxFor(m => m.Image, new { @id="imgpro"})
                <input id="chonanh" type="button" value="Chọn Ảnh" />
            </td>
        </tr>
        <tr>
            <th>Supplier</th>
           @* <td>@Html.DropDownListFor(m=>m.SupplierId,(SelectList)ViewBag.SupplierId, "Id", "Name", "Please select")</td>*@
            <td>@Html.DropDownListFor(m => m.SupplierId, (SelectList)ViewBag.SupplierId,"Select value")</td>
        </tr>
        <tr>
            <th>Category</th>
            <td>@Html.DropDownListFor(m=>m.CategoryId,(SelectList)ViewBag.CategoryId,"Select value")</td>
        </tr>
        <tr>
            <th>Latest ?</th>
            <td>
                <label>@Html.RadioButtonFor(m => m.Latest, true) Yes</label>
                <label>@Html.RadioButtonFor(m => m.Latest, false) No</label>
            </td>
        </tr>
        <tr>
            <th>Special ?</th>
            <td>
                <label>@Html.RadioButtonFor(m => m.Special, true) Yes</label>
                <label>@Html.RadioButtonFor(m => m.Special, false) No</label>
            </td>
        </tr>
        <tr>
            <th>Available ?</th>
            <td>
                <label>@Html.RadioButtonFor(m => m.Available, true) Yes</label>
                <label>@Html.RadioButtonFor(m => m.Available, false) No</label>
            </td>
        </tr>
        <tr>
            <th>Online Views</th>
            <td>@Html.TextBoxFor(m => m.OnlineViews)</td>
        </tr>
        <tr>
            <th>Description</th>
            <td>@Html.TextAreaFor(m => m.Description, new { rows = 6, @id="Description" })</td>
        </tr>
        <tr>
            <th>&nbsp;</th>
            <td>
                <input type="submit" name="command" class="art-button" value="insert" />
                <input type="submit" name="command" class="art-button" value="update" />
                @if(User.IsInRole("Administrator")){
                <input type="submit" name="command" class="art-button" value="delete" />
                }
                <input type="submit" name="command" class="art-button" value="clear" />
            </td>
        </tr>
    </table>

    </div>
    <div id="T2">
        <table>
            <tr>
                <th>ID</th>
                <th>Tên</th>
                <th>Giá</th>
                <th>Chi Tiết</th>
                <th>Số Lượng</th>
                <th>Số Lượt Xem</th>
                <th>&nbsp;</th>


            </tr>
           
        </table>

    </div>
    
</div>


}
<script type="text/javascript">
   
    $(function () {
        $("#chonanh").click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $("#imgpro").val(fileUrl);
            };
            finder.popup();
        });
       
    });
    $(document).ready(function () {
        $("#tabs").tabs();
    });
   
   
    
</script>
<script type="text/javascript">
    var editor;
    function createEditor(languageCode, id) {
        var editor = CKEDITOR.replace(id, {
            language: languageCode
        });
    }

    $(function () {
        createEditor('vi', 'Description');
    });
</script>